package com.lagou.edu.controller;


import com.lagou.edu.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/login")
public class MailController {


    @Autowired
    private MailService mailService;

    @RequestMapping("/{email}/{code}")
    public String sendMail(@PathVariable("email") String email, @PathVariable("code") String code){
        try {
            mailService.sendMail(email,"lagouedu验证码", code);
            return "验证码发送成功！";
        } catch (Exception e){
            return "验证码发送失败！";
        }
    }
}
